/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lolbuilder.calculation;

import java.util.ArrayList;
import java.util.Collections;
import lolbuilder.Items.Interf.ItemsSuper;
import lolbuilder.build.Build;
import lolbuilder.mainClasses.AllItems;
import lolbuilder.mainClasses.MainObjectWriter;

/**
 *
 * @author chocoboSan
 */
public class ObjectPushingThread extends Thread {
    int startPos=0;
    int endPos=0;
    
    public ObjectPushingThread(int s,int e) {
        this.startPos=s;
        this.endPos=e;
    }
    
    public void run() {
        int i;
        System.out.println("i do : "+startPos +" to "+(endPos-1));
        for (i=startPos;i<endPos;i++) {
            ItemsSuper i0=AllItems.items.get(i);
            for (ItemsSuper i1 : AllItems.items) {
                for (ItemsSuper i2 : AllItems.items) {
                    for (ItemsSuper i3 : AllItems.items) {
                        for (ItemsSuper i4 : AllItems.items) {
                            for (ItemsSuper i5 : AllItems.items) {
                               ArrayList<String> ss= new ArrayList<String>();
                                
                               ss.add(i0.toString());
                               ss.add(i1.toString());
                               ss.add(i2.toString());
                               ss.add(i3.toString());
                               ss.add(i4.toString());
                               ss.add(i5.toString());
                               Collections.sort(ss);
                               String s="";
                               for (String s2 : ss) s+=s2;
                               /*if (MainObjectWriter.buildsFound.get(s)==null) {
                                   MainObjectWriter.buildsFound.put(s, 1);
                                   Build tmp=new Build();
                                    tmp.items.add(i0);
                                    tmp.items.add(i1);
                                    tmp.items.add(i2);
                                    tmp.items.add(i3);
                                    tmp.items.add(i4);
                                    tmp.items.add(i5);
                                    /*boolean notsamebuild=true;
                                    int count;
                                    for (count=0;count<builds.size() && notsamebuild;count++) {
                                        if (testIsSameBuild(builds.get(count), tmp)) {
                                                notsamebuild=false;
                                                break;
                                        }
                                    }
                                    if (notsamebuild)*/
                                    /*if (!dispoBuilds.add(tmp)) System.out.println("bug");
                                    if (dispoBuilds.size()>=HOWMUCH) {
                                            synchronized(mutex) {
                                            mutex.notify();
                                                try {
                                                    mutex.wait();
                                                } catch (InterruptedException ex) {
                                                    Logger.getLogger(LinearCompositionThread.class.getName()).log(Level.SEVERE, null, ex);
                                                }
                                        }
                                    }
                                    synchronized(MainObjectWriter.dispoBuilds) {
                                        MainObjectWriter.dispoBuilds.add(tmp);
                                    }
                                    tmp=null;
                                }*/
                            }
                        }
                    }
                }
            }
            i++;
            
            
       }
    }
}
